Add KV identity graph with CAS concurrency control (#536)#549
Closed
ChristianPavilonis wants to merge 1 commit intofeature/edge-cookiesfrom
Closed
Add KV identity graph with CAS concurrency control (#536)#549ChristianPavilonis wants to merge 1 commit intofeature/edge-cookiesfrom
ChristianPavilonis wants to merge 1 commit intofeature/edge-cookiesfrom
Conversation
2587b7a to
e52ff39
Compare
Implement Story 3 (#536): KV-backed identity graph with compare-and-swap concurrency, partner ID upserts, tombstone writes for consent withdrawal, and revive semantics. Includes schema types, metadata, 300s last-seen debounce, and comprehensive unit tests. Also incorporates earlier foundation work: EC module restructure, config migration from [edge_cookie] to [ec], cookie domain computation, consent gating fixes, and integration proxy revocation support.
2f6c9e4 to
a44ead1
Compare
Collaborator
Author
|
Superseded by #582 which consolidates the full EC epic into a single PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
KvIdentityGraphbacked by Fastly KV Store with optimistic concurrency control (generation markers) for safe concurrent partner ID writes.KvEntry,KvConsent,KvGeo,KvPartnerId,KvMetadata) with factory methods for initial, minimal recovery, and tombstone entries.upsert_partner_idandupdate_last_seenprevent late syncs from repopulating partner IDs or extending TTL after consent withdrawal.Closes #536
Changes
ec/kv.rsKvIdentityGraphstruct with 8 methods:get,get_metadata,create,create_or_revive,upsert_partner_id,update_last_seen,write_withdrawal_tombstone,deleteec/kv_types.rsKvEntry::new,::minimal,::tombstone,KvMetadata::from_entry,KvGeo::from_geo_info), 14 unit testsec/mod.rspub mod kv; pub mod kv_types;and module doc entriesfastly.tomlec_identity_storeandec_partner_storeKV store declarationstrusted-server.tomlec_storeandpartner_storeto[ec]sectionKey design decisions
try_insert_addhelper — ReturnsOk(true)for created,Ok(false)for key-exists,Errfor real failures. Avoids fragile string matching on error debug output.MAX_CAS_RETRIES = 3for all CAS operations. No unbounded recursion.upsert_partner_idrejects tombstoned entries;update_last_seenskips them. Prevents late syncs from resurrecting withdrawn consent.update_last_seen— Prevents write thrashing under bursty traffic (Fastly KV enforces 1 write/sec per key).consent_withdrawnfromec_hash_not_found.Result— Callers decide error policy (swallow on organic paths, propagate on sync endpoints).Verification
cargo fmt --all -- --check— cleancargo clippy --workspace --all-targets --all-features -- -D warnings— zero warningscargo test --workspace— 729 tests passed, 0 failed (14 new tests for schema types + KV helpers)